<template>
  <div id="app">
    <header-bar></header-bar>
    <app-fixed></app-fixed>
    <router-view></router-view>
    <nav-footer></nav-footer>
  </div>
</template>


<script>
import HeaderBar from "@/components/index/HeaderBar"
import NavFooter from "@/components/NavFooter"
import AppFixed from "@/components/AppFixed"
export default {
  components: {
    HeaderBar,
    NavFooter,
    AppFixed
  },
  created () {
    this.isPhone();
    this.resize()
  },
  methods: {
    //判断电脑是否是PC
      IsPC() {
        var userAgentInfo = navigator.userAgent;
        var Agents = ["Android", "iPhone",
            "SymbianOS", "Windows Phone",
            "iPad", "iPod"];
        var flag = true;
        for (var v = 0; v < Agents.length; v++) {
            if (userAgentInfo.indexOf(Agents[v]) > 0) {
              flag = false;
              break;
            }
        }
        return flag;
      },
      // 跳转
      isPhone() {
        let hasPc = this.IsPC()
        if (!hasPc) {
            let http = window.location
            let control = http.protocol
            let host = http.host
            let url = `${control}//${host}/mobile`
            window.location.href = url 
        }
      },
      resize() {
        let self = this
         window.onresize = function name() {
            
              let hasPc = self.IsPC()
              if (!hasPc) {
                let http = window.location
                let control = http.protocol
                let host = http.host
                let url = `${control}//${host}/mobile`
                window.location.href = url
              } 
        }
      },
  },
}
</script>
<style lang="scss">
@import "./assets/font/iconfont.css";
html,body {
  width: 100%;
  // max-width: 1920px;
  margin: 0 auto;
  // &::-webkit-scrollbar {
  //   display: none;
  // }
}
#app {
  width: 100%;
  min-width: 1440px;
  overflow: hidden;
  margin: 0 auto;
  padding-top: 130px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  text-decoration: none;
  outline: none;
}
.el-header {
  padding:0;
}
.el-main {
  padding:0 !important;
}
.el-footer {
  padding: 0 !important;
}
</style>
